/*
 * ChartZoomPanel.hpp
 *
 * Copyright 2012 Pieter Agten
 *
 * This file is part of tltgen.
 *
 * tltgen is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * tltgen is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with tltgen.  If not, see <http://www.gnu.org/licenses/>.
 */

/**
 * @file   ChartZoomPanel.hpp
 * @author Pieter Agten (pieter.agten@gmail.com)
 * @date   16 jan 2013
 */

#ifndef CHARTZOOMPANEL_HPP
#define CHARTZOOMPANEL_HPP

#include <wx/wx.h>
#include <wx/spinctrl.h>

namespace tltgen {

  DECLARE_EVENT_TYPE(wxEVT_VERTICAL_START_CHANGED, -1)
  DECLARE_EVENT_TYPE(wxEVT_VERTICAL_END_CHANGED, -1)
  DECLARE_EVENT_TYPE(wxEVT_HORIZONTAL_START_CHANGED, -1)
  DECLARE_EVENT_TYPE(wxEVT_HORIZONTAL_END_CHANGED, -1)

  class ChartZoomPanel : public wxPanel {
  public:
    ChartZoomPanel(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL, const wxString& name = _("ChartZoomPanel"));

    bool isValidRange(int min, int max) const;
    
    int getVerticalRangeMin() const;
    int getVerticalRangeMax() const;
    void setVerticalRangeBounds(int min, int max);

    int getVerticalRangeStart() const;
    int getVerticalRangeEnd() const;
    void setVerticalRange(int start, int end);


    int getHorizontalRangeMin() const;
    int getHorizontalRangeMax() const;
    void setHorizontalRangeBounds(int min, int max);

    int getHorizontalRangeStart() const;
    int getHorizontalRangeEnd() const;
    void setHorizontalRange(int start, int end);


  protected:
    DECLARE_EVENT_TABLE()

    void OnVMinSpinCtrlChanged(wxSpinEvent& event);
    void OnVMaxSpinCtrlChanged(wxSpinEvent& event);
    void OnHMinSpinCtrlChanged(wxSpinEvent& event);
    void OnHMaxSpinCtrlChanged(wxSpinEvent& event);

    wxPanel *createVerticalAxisPanel(); 
    wxPanel *createHorizontalAxisPanel(); 

  private:
    wxSpinCtrl *scVerticalMin;
    wxSpinCtrl *scVerticalMax;
    wxSpinCtrl *scHorizontalMin;
    wxSpinCtrl *scHorizontalMax;
  };

  enum {
    ID_VMin = 1,
    ID_VMax,
    ID_HMin,
    ID_HMax,
  };


}

#endif
